﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace dai_hoc_tuong_lai
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
               "Login", // Route name
                   "thanh-vien/dang-nhap", // URL with parameters
                   new { controller = "Account", action = "Login" }
               );

            routes.MapRoute(
              "MenuTongQuan", // Route name
              "Home/MenuTongQuan", // URL with parameters
              new { controller = "Home", action = "MenuTongQuan" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
              "IndexTintuc", // Route name
              "tin-tuc", // URL with parameters
              new { controller = "TinTuc", action = "Index" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
              "IndexTuyensinh", // Route name
              "tuyen-sinh", // URL with parameters
              new { controller = "TuyenSinh", action = "Index" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
              "Nganhhoc", // Route name
              "nganh-hoc", // URL with parameters
              new { controller = "Cours", action = "Index" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
              "vanphongdichvu", // Route name
              "van-phong-dich-vu", // URL with parameters
              new { controller = "ServiceOffic", action = "Index" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
             "gioithieu", // Route name
             "gioi-thieu", // URL with parameters
             new { controller = "Home", action = "Gioithieu" },
             new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
         );

            routes.MapRoute(
             "lienhe", // Route name
             "lien-he", // URL with parameters
             new { controller = "Home", action = "Lienhe" },
             new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
         );

            routes.MapRoute(
            "AnhDep", // Route name
            "anh-hoat-dong", // URL with parameters
            new { controller = "AnhDep", action = "Index" },
            new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
        );

            routes.MapRoute(
             "MenuAnhdep", // Route name
             "AnhDep/MenuAnhdep/{parent}", // URL with parameters
             new { controller = "AnhDep", action = "MenuAnhdep" },
             new { parent = @"([a-z0-9\.-]+)" },
             new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
         );

            routes.MapRoute(
              "_MenuNganhHoc", // Route name
              "Cours/_MenuNganhHoc/{parent}", // URL with parameters
              new { controller = "Cours", action = "_MenuNganhHoc" },
              new { parent = @"([a-z0-9\.-]+)" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
              "TongquangDetails", // Route name
              "gioi-thieu/{id}/{name}", // URL with parameters
              new { controller = "Home", action = "TongquangDetails" },
              new { id = @"([a-z0-9\.-]+)", name = @"([a-z0-9\.-]+)" },
              new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
          );

            routes.MapRoute(
             "AnhDepDetails", // Route name
             "anh-dep/{id}/{name}", // URL with parameters
             new { controller = "AnhDep", action = "Index" },
             new { id = @"([a-z0-9\.-]+)", name = @"([a-z0-9\.-]+)" },
             new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
         );

            routes.MapRoute(
             "NewsDetails", // Route name
             "tin-tuc/{id}/{name}", // URL with parameters
             new { controller = "TinTuc", action = "NewsDetails" },
             new { id = @"([a-z0-9\.-]+)", name = @"([a-z0-9\.-]+)" },
             new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
         );

            routes.MapRoute(
            "DetailsServiceOffic", // Route name
            "van-phong-dich-vu/{id}/{name}", // URL with parameters
            new { controller = "ServiceOffic", action = "Details" },
            new { id = @"([a-z0-9\.-]+)", name = @"([a-z0-9\.-]+)" },
            new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
        );


            routes.MapRoute(
             "TuyensinhDetails", // Route name
             "tuyen-sinh/{id}/{name}", // URL with parameters
             new { controller = "TuyenSinh", action = "NewsDetails" },
             new { id = @"([a-z0-9\.-]+)", name = @"([a-z0-9\.-]+)" },
             new string[] { "dai_hoc_tuong_lai.Controllers" }// Parameter defaults
         );

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}